package com.example.project3.service.ICS;


import net.fortuna.ical4j.model.property.CalScale;
import net.fortuna.ical4j.model.property.ProdId;
import net.fortuna.ical4j.model.property.Version;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @ClassName Config .java
 * @Description empty
 * @Author LiuJinyu
 * @Date 2023/5/29 14:04
 * @Version 1.0
 */
@Configuration
public class Calendar {

    private ProdId prodId;

    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    @Scope(SCOPE_REQUEST)
    public net.fortuna.ical4j.model.Calendar getCalendar() {
        net.fortuna.ical4j.model.Calendar calendar = new net.fortuna.ical4j.model.Calendar();
        calendar.getProperties().add(prodId);
        calendar.getProperties().add(Version.VERSION_2_0);
        calendar.getProperties().add(CalScale.GREGORIAN);
        return calendar;
    }


    @Autowired
    public void setGetProdId(net.fortuna.ical4j.model.property.ProdId getProdId) {
        this.prodId = getProdId;
    }
}
